<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="static/element/index.css">
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title></title>
    <style>

        * {
            padding: 0;
            margin: 0;
        }

        html {
            overflow-y: hidden;
        }

        body, html {
            width: 100%;
            height: 100%;
        }

        body {
            display: flex;
            flex-flow: column;
        }

        .fheader {
            height: 1%;
            min-height: 50px;
        }

        .fsection {
            /*flex-grow: 1;*/
            display: flex;
            flex-flow: row;
            margin-top: 10px;
            /*height: 99%;*/
            min-height: 0;
        }

        .farticle {
            flex: 1;
            padding: 1px;
        }

        .el-table__body tr:hover > td {
            background-color: #DFDFDF !important;
            cursor: default
        }

    </style>
</head>
<body>
<div id="app">
    <div class="fheader" style="padding: 0;margin: 0 ">
        <nav class="breadcrumb" style="height: 100%; padding: 0;margin-top: 8px ">
            <div class="l" style="margin-left: 20px; padding-top: 8px">
                <a @click="fAdd" class="btn btn-primary radius" id="add"><i class="Hui-iconfont">&#xe600;</i> 新增</a>
            </div>
            <a class="btn btn-success radius l" style="line-height:1.6em;margin-top:8px; margin-left: 10px" @click="fInit()" title="刷新">
                <i class="Hui-iconfont">&#xe68f;</i>
            </a>
            <span class="r" style="padding-top: 2px">共计人员：[&nbsp;<strong>{{tableCounter.VALUE01}}</strong> 人]</span>
        </nav>
    </div>
    <div class="fsection">
        <div class="farticle">
            <div style="height: 100%; width: 100%; overflow: scroll; float: left; overflow-x: hidden;">
                <el-table :data="tableData" stripe border style="width: 100%" :height="tableHeightL" empty-text="没有数据" :header-cell-style="tableHeaderCellStyleL" :cell-style="tableCellStyleL">
                    <el-table-column prop="VALUE01" label="系统编号" width="120"></el-table-column>
                    <el-table-column prop="VALUE06" label="登录帐号" width="120"></el-table-column>
                    <el-table-column prop="VALUE02" label="姓名" width="160"></el-table-column>
                    <el-table-column prop="VALUE03" label="联系电话" width="160"></el-table-column>
                    <el-table-column prop="VALUE04" label="状态" width="130"></el-table-column>
                    <el-table-column label="操作" show-overflow-tooltip>
                        <template slot-scope="scope">
                            <el-button type="primary" @click="fJy('禁用',scope.row)" size="mini" style="width: 80px">禁用</el-button>
                            <el-button type="primary" @click="fQy('启用',scope.row)" size="mini" style="width: 80px">启用</el-button>
                            <el-button type="primary" @click="fCdqx('菜单权限',scope.row)" size="mini" style="width: 80px">菜单权限</el-button>
<%--                                                        <el-button type="primary" @click="fYwqx('业务权限',scope.row)" size="mini" style="width: 80px">业务权限</el-button>--%>
                            <el-button type="primary" @click="fBmfw('部门范围',scope.row)" size="mini" style="width: 80px">部门范围</el-button>
                            <el-button type="primary" @click="fBj('编辑',scope.row, 'UPDATE')" size="mini" style="width: 80px">编辑</el-button>
                            <el-button type="warning" @click="fMmcz('密码重置',scope.row)" size="mini" style="width: 80px">密码重置</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
        </div>
    </div>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="static/axios.min.js"></script>
<script type="text/javascript" src="./static/vue"></script>
<script src="static/element/index.js"></script>
<script type="text/javascript">
    let vm = new Vue({
        el: '#app',
        data: {
            tableHeightL: 0,
            tableData: [],      //--具体人员信息表
            tableCounter: {},    //--统计信息表
        },
        methods: {
            //--禁用
            fJy(title, obj) {
                if (obj.VALUE01.toString() === '1') {
                    layer.msg('无需对系统管理员进行相关操作!', {icon: 0, time: 2000});
                    return
                }
                if (obj.VALUE04.toString() === '禁用') {
                    layer.msg('该账户出于禁用状态，无需重复禁用!', {icon: 0, time: 2000});
                    return
                }

                let self = this
                layer.confirm("请问是否确定禁用操作？", {
                    btn: ["确定", "取消"] //按钮
                }, function () {
                    let params = new URLSearchParams();
                    params.append('CMD', "AD");
                    params.append('VALUE01', obj.VALUE01.toString());
                    params.append('VALUE02', '禁用');
                    axios.post('/f_wscl/com2', params)
                        .then(function (res) {
                            let {db1} = res.data
                            if (db1[0].VALUE01 === 'ZZ01') {
                                layer.msg(db1[0].VALUE02, {icon: 0, time: 2000});
                            } else if (db1[0].VALUE01 === 'ZZ00') {
                                layer.msg('数据库操作完毕!', {icon: 1, time: 1500}, function () {
                                    let index = parent.layer.getFrameIndex(window.name);
                                    self.fInit();
                                });
                            }
                        })
                        .catch(function (error) {
                            layer.msg('网络异常错误', {icon: 1, time: 1000});
                        });
                }, function () {
                });
            },

            //--启用
            fQy(title, obj) {
                if (obj.VALUE01.toString() === '1') {
                    layer.msg('无需对系统管理员进行相关操作!', {icon: 0, time: 2000});
                    return
                }
                if (obj.VALUE04.toString() === '启用') {
                    layer.msg('该账户出于正常状态，无需重复启用!', {icon: 0, time: 2000});
                    return
                }

                let self = this
                layer.confirm("请问是否确定启用操作？", {
                    btn: ["确定", "取消"] //按钮
                }, function () {
                    let params = new URLSearchParams();
                    params.append('CMD', "AD");
                    params.append('VALUE01', obj.VALUE01.toString());
                    params.append('VALUE02', '启用');
                    axios.post('/f_wscl/com2', params)
                        .then(function (res) {
                            let {db1} = res.data
                            if (db1[0].VALUE01 === 'ZZ01') {
                                layer.msg(db1[0].VALUE02, {icon: 0, time: 2000});
                            } else if (db1[0].VALUE01 === 'ZZ00') {
                                layer.msg('数据库操作完毕!', {icon: 1, time: 1500}, function () {
                                    let index = parent.layer.getFrameIndex(window.name);
                                    self.fInit();
                                });
                            }
                        })
                        .catch(function (error) {
                            layer.msg('网络异常错误', {icon: 1, time: 1000});
                        });
                }, function () {
                });
            },

            //--密码重置
            fMmcz(title, obj) {
                if (obj.VALUE01.toString() === '1') {
                    layer.msg('无需对系统管理员进行相关操作!', {icon: 0, time: 2000});
                    return
                }

                let self = this
                layer.confirm("请问是否确定重置密码？", {
                    btn: ["确定", "取消"] //按钮
                }, function () {
                    let params = new URLSearchParams();
                    params.append('CMD', "AK");
                    params.append('VALUE01', obj.VALUE01.toString());
                    axios.post('/f_wscl/com2', params)
                        .then(function (res) {
                            let {db1} = res.data
                            if (db1[0].VALUE01 === 'ZZ01') {
                                layer.msg(db1[0].VALUE02, {icon: 0, time: 2000});
                            } else if (db1[0].VALUE01 === 'ZZ00') {
                                layer.msg('密码重置操作完毕!', {icon: 1, time: 1500}, function () {
                                    let index = parent.layer.getFrameIndex(window.name);
                                    self.fInit();
                                });
                            }
                        })
                        .catch(function (error) {
                            layer.msg('网络异常错误', {icon: 1, time: 1000});
                        });
                }, function () {
                });
            },

            //--菜单权限
            fCdqx(title, obj) {
                if (obj.VALUE01.toString() === '1') {
                    layer.msg('无需对系统管理员进行相关操作!', {icon: 0, time: 2000});
                    return
                }

                let params = new URLSearchParams();
                params.append('CMD', "ZC");
                params.append('VALUE01', obj.VALUE01.toString());
                axios.post('/f_wscl/com2', params)
                    .then(function (res) {
                        let {db1, db2, db3} = res.data
                        layer.open({
                            type: 2,
                            area: ['800px', '700px'],
                            fix: false, //不固定
                            maxmin: false,
                            shade: 0.4,
                            title: title,
                            content: 'right?JUD=CDQX&CMD=ZD&VALUE01=' + obj.VALUE01.toString(),
                            success: function (layero, index) {
                                const iframeWin = window[layero.find('iframe')[0]['name']];   //--通过将弹出的layer窗口中将vue中的函数在created周期中赋给windows，
                                iframeWin.fInit({
                                    "checkFu": db1,
                                    "checkZi": db2,
                                    "checkAll": db3,
                                    "ryzh": obj.VALUE01.toString(),
                                    "ryxm": obj.VALUE02.toString()
                                })
                            },
                        });
                    })
                    .catch(function (error) {
                        layer.msg('网络异常错误', {icon: 1, time: 1000});
                    });
            },

            //--业务权限
            fYwqx(title, obj) {
                if (obj.VALUE01.toString() === '1') {
                    layer.msg('无需对系统管理员进行相关操作!', {icon: 0, time: 2000});
                    return
                }

                let params = new URLSearchParams();
                params.append('CMD', "ZC");
                params.append('VALUE01', obj.VALUE01.toString());
                axios.post('/f_wscl/com2', params)
                    .then(function (res) {
                        let {db1, db2, db3} = res.data
                        layer.open({
                            type: 2,
                            area: ['800px', '700px'],
                            fix: false, //不固定
                            maxmin: false,
                            shade: 0.4,
                            title: title,
                            content: 'right?JUD=YWQX&CMD=ZD&VALUE01=' + obj.VALUE01.toString(),
                            success: function (layero, index) {
                                const iframeWin = window[layero.find('iframe')[0]['name']];   //--通过将弹出的layer窗口中将vue中的函数在created周期中赋给windows，
                                iframeWin.fInit({
                                    "ryzh": obj.VALUE01.toString(),
                                    "ryxm": obj.VALUE02.toString()
                                })
                            },
                        });
                    })
                    .catch(function (error) {
                        layer.msg('网络异常错误', {icon: 1, time: 1000});
                    });
            },

            //--部门范围
            fBmfw(title, obj) {
                if (obj.VALUE01.toString() === '1') {
                    layer.msg('无需对系统管理员进行相关操作!', {icon: 0, time: 2000});
                    return
                }

                let params = new URLSearchParams();
                params.append('CMD', "AH");
                params.append('VALUE01', obj.VALUE01.toString());
                axios.post('/f_wscl/com2', params)
                    .then(function (res) {
                        let {db1, db2} = res.data
                        layer.open({
                            type: 2,
                            area: ['800px', '700px'],
                            fix: false, //不固定
                            maxmin: false,
                            shade: 0.4,
                            title: title,
                            content: ['w_zxkj_userbmfw.jsp', 'no'],
                            success: function (layero, index) {
                                const iframeWin = window[layero.find('iframe')[0]['name']];   //--通过将弹出的layer窗口中将vue中的函数在created周期中赋给windows，
                                iframeWin.fInit({
                                    "ryzh": obj.VALUE01.toString(),
                                    "ryxm": obj.VALUE02.toString(),
                                    "tableAllbm": db1,
                                    "checkAllbm": db2
                                })
                            },
                        });
                    })
                    .catch(function (error) {
                        layer.msg('网络异常错误', {icon: 1, time: 1000});
                    });
            },

            //--编辑
            fBj(title, obj, jud) {
                layer.open({
                    type: 2,
                    area: ['800px', '400px'],
                    fix: false, //不固定
                    maxmin: false,
                    shade: 0.4,
                    title: title,
                    content: ['w_zxkj_useredit.jsp', 'no'],
                    success: function (layero, index) {
                        const iframeWin = window[layero.find('iframe')[0]['name']];   //--通过将弹出的layer窗口中将vue中的函数在created周期中赋给windows，
                        iframeWin.fInit({
                            "do": jud,
                            "tableLs": obj,
                        })
                    },
                });
            },

            tableHeaderCellStyleL({row, column, rowIndex, columnIndex}) {
                let cellStyle1;

                cellStyle1 = "color: #fff;" +
                    "background:#4F4F4F;" +
                    "text-align:center;" +
                    "font-size:15px"

                return cellStyle1
            },

            tableCellStyleL({row, column, rowIndex, columnIndex}) {
                let cellStyle1;

                if (columnIndex === 5) {
                    cellStyle1 = "text-align:left;" +
                        "padding:8px 1px 8px;" +
                        "font-size:15px"
                } else {
                    cellStyle1 = "text-align:center;" +
                        "padding:8px 1px 8px;" +
                        "font-size:15px"
                }
                return cellStyle1;
            },

            //--初始数据查询
            fInit() {
                let self = this
                let params = new URLSearchParams();
                params.append('CMD', "ZZ");
                axios.post('/f_wscl/com2', params)
                    .then(function (res) {
                        let {db1, db2} = res.data
                        self.tableData = db1
                        self.tableCounter = db2[0]
                    })
                    .catch(function (error) {
                        layer.msg('网络异常错误', {icon: 1, time: 1000});
                    });
            },

            fAdd() {
                //--首先获取最大的编号，虽然获取的编号是个虚的
                let self = this
                let params = new URLSearchParams();
                params.append('CMD', "ZQ");
                params.append('VALUE01', "Z_USER");

                axios.post('/f_wscl/com2', params)
                    .then(function (res) {
                        let {db1} = res.data
                        self.fBj('操作员信息新增', db1[0], "INSERT")
                    })
                    .catch(function (error) {
                        layer.msg('网络异常错误', {icon: 1, time: 1000});
                    });
            },

        },
        mounted() {
            window.fInit = this.fInit;
        },
        created() {
            let windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
            this.tableHeightL = windowHeight - 85;
            this.fInit()
        }
    });

</script>

</body>
</html>
